#!/bin/sh /etc/rc.common
# Copyright (c) 2014 Qualcomm Atheros, Inc.
#
# All Rights Reserved.
# Qualcomm Atheros Confidential and Proprietary.

. /lib/ipq806x.sh

START=99

SERVICE_WRITE_PID=1
SERVICE_DAEMONIZE=1

start() {
    local enabled

    config_load 'thermal'
    config_get_bool enabled config 'Enabled' '0'

    [ "$enabled" -gt 0 ] || {
        return 1
    }

    #use board specific thermal config file
    case "$(ipq806x_board_name)" in
	ap148 |ap145)
		service_start /usr/sbin/thermald -c /etc/thermal/ipq-thermald-8064.conf
		;;
	db149)
		service_start /usr/sbin/thermald -c /etc/thermal/ipq-thermald-8064.conf
		;;
    esac
}

stop() {
    service_stop /usr/sbin/thermald
}

restart() {
    stop
    start
}
